package com.xzlzx.quarkus;


import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;

@Path("/hello")
public class GreetingResource {

    int a = 1;

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello() {
        a++;
        System.out.println(a);
        return "hello!";
    }

    @Path("/test/test")
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String test(
            @QueryParam("m") String m,@QueryParam("n") Integer n) {
        System.out.println(m);
        System.out.println(n);
        return "test test!";
    }


    @Path("/test/post")
    @POST
//    @Produces(MediaType.TEXT_PLAIN)
    public String testPost(Body body) {
//        System.out.println(m);
//        System.out.println(n);

        System.out.println(body.id);
        System.out.println(body.name);
        return "test test!";
    }

    @Path("/a/{name}")
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String pathParam(@PathParam("name") String name) {
        a++;
        System.out.println(a);
        return name + "world!";
    }

    @GET
    @Path("/world")
    @Produces(MediaType.TEXT_PLAIN)
    public String world() {
        a++;
        System.out.println(a);
        return "world!";
    }
}